package com.jomolangma.app.thinkingjava.io;

//: io/AvailableCharSets.java
// Displays Charsets and aliases
import java.nio.charset.Charset;
import java.util.Iterator;
import java.util.SortedMap;

public class AvailableCharSets {
	public static void main(String[] args) {
		SortedMap<String, Charset> charSets = Charset.availableCharsets();
		Iterator<String> it = charSets.keySet().iterator();
		while (it.hasNext()) {
			String csName = it.next();
			System.out.print(csName);
			Iterator<?> aliases = charSets.get(csName).aliases().iterator();
			if (aliases.hasNext())
				System.out.print(": ");
			while (aliases.hasNext()) {
				System.out.print(aliases.next());
				if (aliases.hasNext())
					System.out.print(", ");
			}
			System.out.println();
		}
	}
} /*
 * Output: Big5: csBig5 Big5-HKSCS: big5-hkscs, big5hk, big5-hkscs:unicode3.0,
 * big5hkscs, Big5_HKSCS EUC-JP: eucjis, x-eucjp, csEUCPkdFmtjapanese, eucjp,
 * Extended_UNIX_Code_Packed_Format_for_Japanese, x-euc-jp, euc_jp EUC-KR:
 * ksc5601, 5601, ksc5601_1987, ksc_5601, ksc5601-1987, euc_kr, ks_c_5601-1987,
 * euckr, csEUCKR GB18030: gb18030-2000 GB2312: gb2312-1980, gb2312, EUC_CN,
 * gb2312-80, euc-cn, euccn, x-EUC-CN GBK: windows-936, CP936 ...
 */// :~
